<html>
<head><meta charset="utf-8"><title>generic member access · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html">generic member access</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="248297870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248297870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248297870">(Aug 04 2021 at 00:38)</a>:</h4>
<p>I've been experimenting with the generic member access implementation in dyno. I think I have a similar but simpler API for the 'object provider' case. I think it handles the same requirements - no explicit type id comparison, supports references (at least those with a  lifetime bound by self) and ?Sized types, does not require Box, supports by value.</p>



<a name="248297889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248297889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248297889">(Aug 04 2021 at 00:38)</a>:</h4>
<p><a href="https://gist.github.com/nrc/293e88c0e796114ef181d1b2d5e1ac7e">https://gist.github.com/nrc/293e88c0e796114ef181d1b2d5e1ac7e</a></p>



<a name="248298033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248298033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248298033">(Aug 04 2021 at 00:40)</a>:</h4>
<p>One worry is casting too and from *mut u8, which I don't recall if that is sound or not. The other worry is that maintaining the lifetime of references is pretty fragile and I'm not convinced it's sound in all variance scenarios.</p>



<a name="248298045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248298045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248298045">(Aug 04 2021 at 00:40)</a>:</h4>
<p>Plus its probably wildly broken in ways I don't understand</p>



<a name="248298069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248298069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248298069">(Aug 04 2021 at 00:41)</a>:</h4>
<p>Anyway, please take a look and tell me what I screwed up!</p>



<a name="248302858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248302858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248302858">(Aug 04 2021 at 01:50)</a>:</h4>
<p>I’m not sure how it handles the closure use case for async runtimes</p>



<a name="248303629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248303629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248303629">(Aug 04 2021 at 02:04)</a>:</h4>
<p>I found one lifetime error already!</p>



<a name="248306091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248306091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248306091">(Aug 04 2021 at 02:59)</a>:</h4>
<p>Gist updated to address the lifetime issue and add some comments</p>



<a name="248307919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248307919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248307919">(Aug 04 2021 at 03:42)</a>:</h4>
<p>In terms of pros/cons, with dyno, the Tags are more first class, which means you can write your own for your types to support more complicated types such as &amp;'a Foo&lt;'b&gt; (my provider only supports &amp;'a Foo&lt;'static&gt;), however, the end user does have to write these tags and if you have to specify the generic type parameters, you have to specify the tag rather than the type. C.f., my proposal where the type is specified. E.g., err.context::&lt;TagType&gt;()</p>



<a name="248307935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248307935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248307935">(Aug 04 2021 at 03:43)</a>:</h4>
<p>Is your version of the provider API implemented ontop of Tag?</p>



<a name="248307938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248307938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248307938">(Aug 04 2021 at 03:43)</a>:</h4>
<p>Haven't had a chance yet to look at it in detail</p>



<a name="248307992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248307992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248307992">(Aug 04 2021 at 03:44)</a>:</h4>
<p>Looks like no</p>



<a name="248308572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248308572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248308572">(Aug 04 2021 at 03:59)</a>:</h4>
<p>No, it uses type tags, but they are not abstracted with a trait</p>



<a name="248517082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248517082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248517082">(Aug 05 2021 at 18:32)</a>:</h4>
<p>taking a look at the version you setup <span class="user-mention" data-user-id="256841">@Nick Cameron</span> it doesn't seem like it would still cover the futures executor case</p>



<a name="248517164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248517164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248517164">(Aug 05 2021 at 18:33)</a>:</h4>
<p>or at least i don't understand how it would if T: 'static</p>



<a name="248517328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248517328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248517328">(Aug 05 2021 at 18:34)</a>:</h4>
<p>ah i guess that's what you meant by "for the object provider case"</p>



<a name="248517352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/generic%20member%20access/near/248517352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/generic.20member.20access.html#248517352">(Aug 05 2021 at 18:34)</a>:</h4>
<p>seems like a reasonable option to include in the RFC</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>